package me.buick.util.snmp.core;

import java.util.regex.Pattern;

/**
 * 
 * Utils for Performance monitor core library
 * 
 * @author buick
 *
 */

public final class Utils {

	private static final String PORT_NUM_EXP = "^([0-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-6][0-5][0-5][0-3][0-5])$";
	private static final String DIGITAL      = "^[0-9_]+$";
	
	public static boolean isEmptyString(String arg){
		if((arg != null) && (arg.trim().length() > 0)){
			return false;
		}else{
			return true;
		}
	}
	
	public static boolean isValidatePortNumber(int portNumber){
		if(Pattern.matches(DIGITAL, portNumber+"") && Pattern.matches(PORT_NUM_EXP, portNumber+"")){
			return true;
		}else{
			return false;
		}
	}
	
	public static boolean isValidatePID(int pid){
		if(Pattern.matches(DIGITAL, pid+"")){
			return true;
		}else{
			return false;
		}
	}
}
